Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Support alter database #4700

Merged
merged 20 commits into from
Dec 17, 2024
Merged

Conversation

jerry-024
Copy link
Contributor

@jerry-024 jerry-024 commented Dec 13, 2024

Purpose

Support alter database
Linked issue: #4540

Tests

  • RESTCatalogTest. testAlterDatabase
  • RESTCatalogTest. testAlterDatabaseWhenDatabaseNotExistAndIgnoreIfNotExistsIsFalse
  • RESTCatalogTest. testAlterDatabaseWhenDatabaseNotExistAndIgnoreIfNotExistsIsTrue
  • HiveCatalogTest. testAlterDatabase
  • JdbcCatalogTest.testAlterDatabase
  • CachingCatalogTest. testInvalidateWhenDatabaseIsAltered

API and Format

  • add alter dabatase API in catalog

Documentation

@jerry-024 jerry-024 marked this pull request as draft December 13, 2024 02:39
@jerry-024 jerry-024 changed the title [Core] Support alert database [Core] Support alter database Dec 13, 2024
…CreateDatabaseReques

fix RESTCatalog

fix checkstyle fail

fix error change in RESTCatalog
@jerry-024 jerry-024 marked this pull request as ready for review December 16, 2024 06:34
Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also support ALTER DATABASE for Flink SQL and Spark SQL?

The following SQL sets one or more properties in the specified database. If a particular property is already set in the database, override the old value with the new one.

```sql
ALTER DATABASE [catalog_name.]db_name SET (key1=val1, key2=val2, ...)
Copy link
Contributor

@JingsongLi JingsongLi Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add example to alter comment and location.

Copy link
Contributor Author

@jerry-024 jerry-024 Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in flink sql couldn't alter comment for the database, so we could only alter the location.

The following SQL sets one or more properties in the specified database. If a particular property is already set in the database, override the old value with the new one.

```sql
ALTER { DATABASE | SCHEMA | NAMESPACE } my_database
Copy link
Contributor

@JingsongLi JingsongLi Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add example to alter comment and location.

try {
Database oldDatabase = catalog.getDatabase(name);
List<PropertyChange> changes =
getPropertyChanges(oldDatabase.options(), newDatabase.getProperties());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here should extract comment from newDatabase?

@Override
public void alterNamespace(String[] namespace, NamespaceChange... changes) {
throw new UnsupportedOperationException("Alter namespace in Spark is not supported yet.");
public void alterNamespace(String[] namespace, NamespaceChange... changes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test in DDLWithHiveCatalogTestBase?

@JingsongLi
Copy link
Contributor

+1

@JingsongLi JingsongLi merged commit 0fb6076 into apache:master Dec 17, 2024
13 checks passed
@jerry-024 jerry-024 deleted the rest-catalog branch December 17, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants